//https://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4?tpId=13&tqId=23261&ru=%2Fpractice%2F8c82a5b80378478f9484d87d1c5f12a4&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D1%26tpId%3D13%26type%3D13
//动态规划思想解决： f(n) = f(n-1) + f(n-2);

class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param number int整型 
     * @return int整型
     */
    // f(n) = f(n-1) + f(n-2);
    int jumpFloor(int number) {
        // write code here
        int res = 0;
        if (number <=0) return res;
        int last_n=1;
        int last_n_n=0;
        for(int i = 1;i<=number;++i) {
            res = last_n + last_n_n;
            last_n_n = last_n;
            last_n = res;
        }
        return res;
    }
};